package com.cn.gxa.redisutils.dao;


import com.cn.gxa.redisutils.bean.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> {//对接 数据库的

    User findByUsernameAndPassword(String username, String password);
    //自定SQL
    @Query(value = "select u.id from  User u order  by u.id",nativeQuery = true)
    List<Integer> findAllIds();
    @Query(value = "select u.name from  User u ",nativeQuery = true)
    List<String> findAllUsernames();

}
